<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl.WWWROOT_BACKEND; ?>/css/form.css"/>

<div class="wd-form">

<?php echo CHtml::beginForm('','post',array('enctype'=>'multipart/form-data')); ?>
	<fieldset>
		<p class="note"><?php echo UserModule::t('Fields with <span class="required">*</span> are required.'); ?></p>

		<?php echo CHtml::errorSummary(array($model,$profile)); ?>

		<div class="wd-input">
			<?php echo CHtml::activeLabelEx($model,'userName'); ?>
			<?php echo CHtml::activeTextField($model,'userName',array('size'=>20,'maxlength'=>20)); ?>
			<?php echo CHtml::error($model,'userName'); ?>
		</div>

		<div class="wd-input">
			<?php echo CHtml::activeLabelEx($model,'password'); ?>
			<?php echo CHtml::activePasswordField($model,'password',array('size'=>60,'maxlength'=>128)); ?>
			<?php echo CHtml::error($model,'password'); ?>
		</div>

		<div class="wd-input">
			<?php echo CHtml::activeLabelEx($model,'email'); ?>
			<?php echo CHtml::activeTextField($model,'email',array('size'=>60,'maxlength'=>128)); ?>
			<?php echo CHtml::error($model,'email'); ?>
		</div>

		<div class="wd-input">
			<?php echo CHtml::activeLabelEx($model,'superuser'); ?>
			<?php echo CHtml::activeDropDownList($model,'superuser',User::itemAlias('AdminStatus')); ?>
			<?php echo CHtml::error($model,'superuser'); ?>
		</div>

		<div class="wd-input">
			<?php echo CHtml::activeLabelEx($model,'status'); ?>
			<?php echo CHtml::activeDropDownList($model,'status',User::itemAlias('UserStatus')); ?>
			<?php echo CHtml::error($model,'status'); ?>
		</div>
	<?php 
			$profileFields=$profile->getFields();
			if ($profileFields) {
				foreach($profileFields as $field) {
				?>
		<div class="wd-input">
			<?php echo CHtml::activeLabelEx($profile,$field->varname); ?>
			<?php 
			if ($field->widgetEdit($profile)) {
				echo $field->widgetEdit($profile);
			} elseif ($field->range) {
				echo CHtml::activeDropDownList($profile,$field->varname,Profile::range($field->range));
			} elseif ($field->field_type=="TEXT") {
				echo CHtml::activeTextArea($profile,$field->varname,array('rows'=>6, 'cols'=>50));
			} else {
				echo CHtml::activeTextField($profile,$field->varname,array('size'=>60,'maxlength'=>(($field->field_size)?$field->field_size:255)));
			}
			 ?>
			<?php echo CHtml::error($profile,$field->varname); ?>
		</div>	
				<?php
				}
			}
	?>
		<div class="wd-submit buttons">
			<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
		</div>
	</fieldset>
<?php echo CHtml::endForm(); ?>

</div><!-- form -->